#include "doubleball.h"
#include "global.h"

doubleball::doubleball()
{
reset();
}

doubleball::doubleball(wxString term)
{
wxString SQL=_(" select * from _DBHISTORY  where term='")+term+_("' order by term desc  limit 0,1");
//::wxGetTextFromUser(wxEmptyString,wxEmptyString,SQL);
DoubleBall* db= new DoubleBall();
 db->query(SQL.char_str());
 if(db->nrow==0)
   {
        wxMessageBox(term+_(" 不存在"));
        return;
    }
      term =wxString::Format(_("%02d"),atoi(db->records[db->ncol+0]));
      date =wxString::Format(_("%02d"),atoi(db->records[db->ncol+1]));
      sequene;//ÐòÁÐºÅ
      redBall1  =atoi(db->records[db->ncol+2]);
      redBall2  =atoi(db->records[db->ncol+3]);
      redBall3  =atoi(db->records[db->ncol+4]);
      redBall4  =atoi(db->records[db->ncol+5]);
      redBall5  =atoi(db->records[db->ncol+6]);
      redBall6  =atoi(db->records[db->ncol+7]);
       blueBall  =atoi(db->records[db->ncol+8]);
       ployName=wxEmptyString;//²ßÂÔÃû       doubleball();
delete db;
}
doubleball::~doubleball()
{
    //dtor
}

 void doubleball::reset()
 {
       term =wxEmptyString;
      date =wxEmptyString;
      sequene;//ÐòÁÐºÅ
      redBall1  =0;
      redBall2  =0;
      redBall3  =0;
      redBall4  =0;
      redBall5  =0;
      redBall6  =0;
       blueBall  =0;
       ployName=wxEmptyString;//²ßÂÔÃû       doubleball();
 }
/*
得到所有红球
*/
wxArrayString doubleball::redBall()
{
wxArrayString result;
  result.Add(wxString::Format(_("%02d"),redBall1));
  result.Add(wxString::Format(_("%02d"),redBall2));
  result.Add(wxString::Format(_("%02d"),redBall3));
  result.Add(wxString::Format(_("%02d"),redBall4));
  result.Add(wxString::Format(_("%02d"),redBall5));
  result.Add(wxString::Format(_("%02d"),redBall6));
return result;
}
